package com.example.securitydemos.mapper;

import com.example.securitydemos.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @author linjy on 2023/1/13
 * @Mapper注解,可带可不带,因为有MapperScan扫描.
 */

@Mapper
public interface UserMapper {

    @Select("SELECT * FROM users WHERE username=#{username}")
    User findByUserName(@Param("username") String username);

    @Insert({"insert into users(username, password,roles,enable) values(#{username}, #{password}, #{roles}, #{enable})"})
    int addUser(User user);

}
